#include"subject.h"

Subject::Subject()
    :SMath(0), SEng(0), SCpp(0)
{
    for (int i = 0; i < 3; i++)
        score[i] = -1;
}

Subject::Subject(int math, int eng, int cpp)
    :SMath(4), SEng(3), SCpp(2)
{
    score[0] = math;
    score[1] = eng;
    score[2] = cpp;
}

void Subject::Display()const
{
    cout << " Math " << " SEng " << " SCpp " << endl;
    cout << SMath << SEng << SCpp << endl;
    for (int i = 0; i < 3; i++)
        cout << "  " << score[i];
    cout << endl;
}

void Subject::Input()
{
    cout << "请输入成绩" << endl;
    cout << "输入 数学：";
    cin >> score[0];
    cout << "输入 英语：";
    cin >> score[1];
    cout << "输入 C++:";
    cin >> score[2];
}

void Subject::Insert()
{
    if (score[0] < 0)
        Input();
}

void Subject::Delete()
{
    for (int i = 0; i < 3; i++)
        score[i] = -1;
}